//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include <cstdlib>

#include <iostream>
#include <fstream>

#include "ListResiduesDistanceLigand.h"
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
using namespace std;
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
int main(int argc, char** argv) {

  String* location;
  String* filenameListIn;
  String* filenameOut;
  String* filenameError;

  double  distance;

  if (argc < 6) {
    cout << "Error in the input arguments. The execution must be: " << endl;
    cout << "./IdentifyBindingSiteInPDBe <Path of the folder with pdb files> <file with list of files> <output file> <error file> <Increase in Angstrom for the Box Around ligand>" << endl;
    return 0;
  }
  else {
    cout << "---------------------------------------------------------------------------------" << endl;
    cout << "          PDB Path : " << argv[1] << endl;
    cout << "List of Input File : " << argv[2] << endl;
    cout << "       Output File : " << argv[3] << endl;
    cout << "        Error File : " << argv[4] << endl;
    cout << "   Increase of Box : " << argv[5] << endl;
    cout << "---------------------------------------------------------------------------------" << endl;
    location        = new String(argv[1]);
    filenameListIn  = new String(argv[2]);
    filenameOut     = new String(argv[3]);
    filenameError   = new String(argv[4]);
    distance        = atof(argv[5]);
  }

  ListResiduesDistanceLigand* listResiduesDistanceLigand = new ListResiduesDistanceLigand();

  listResiduesDistanceLigand->Location(location);
  listResiduesDistanceLigand->ListInFilename(filenameListIn);
  listResiduesDistanceLigand->FilenameOut(filenameOut);
  listResiduesDistanceLigand->FilenameError(filenameError);
  listResiduesDistanceLigand->Distance(distance);

  listResiduesDistanceLigand->ConstructFileLargestLigandUsingList();

  cout << "---------------------------------------------------------------------------------" << endl;

  if (listResiduesDistanceLigand) delete listResiduesDistanceLigand;

  return 1;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
